package cn.middle.swap.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.middle.common.base.mapper.BaseMapper;
import com.middle.common.base.service.impl.BaseServiceImpl;
import com.middle.common.result.Page;

import cn.middle.swap.entity.App;
import cn.middle.swap.mapper.AppMapper;
import cn.middle.swap.service.AppService;

@Service
public class AppServiceImpl extends BaseServiceImpl<App> implements AppService {

	@Autowired
	private AppMapper mapper;
	
	@Override
	public BaseMapper<App> getDao() {
		return mapper;
	}

	@Override
	public Page<App> listConditions(int page, int pageSize, String name) {
		PageHelper.startPage(page, pageSize);
		List<App> apps = this.mapper.listConditions(name);
		return new Page<>(new PageInfo<>(apps));
	}

	@Override
	public App login(String username, String password, int clientId) {
		return this.mapper.login(username, password, clientId);
	}

}
